<?php

namespace App\Admin\Forms\Catesets;

use Encore\Admin\Widgets\Form;
use Illuminate\Support\Facades\Schema;
use App\Models\App;
use App\Models\Cate;

class Base extends Setbase
{
    /**
     * The form title.
     *
     * @var string
     */
    public $title = '基础';
	
    /**
     * Build a form here.
     */
    public function form()
    {
		$id = request('id');
		$app  = get_app_cate(false,$id);

		$this->hidden('id');
		foreach(config('exts') as $name=>$set){		
			if( empty($set['field']) && $name != 'cate'){          //无字段支持通用关联应用
				$this->switch($name, '启用'.$set['title'])->help('是否启用'.$set['title'].'功能 (sets.base.'.$name.')');
			}elseif(in_array($set['name'],$app['commons']) && $name != 'cate'){
				$this->switch($name, '启用'.$set['title'])->help('是否启用'.$set['title'].'功能,<b>本功能依赖'.$set['field'].'字段</b> (sets.base.'.$name.')');
			}
		}
		
		//恢复设置
		$this->reset_app();

    }
}
